﻿import { Component, Injector, NgZone, ViewChild } from '@angular/core';
import { ModalDirective } from 'ngx-bootstrap';
import { AppComponentBase } from '@shared/common/app-component-base';
import { TechFileInfoHistoryDto, TechFileInfoServiceProxy } from '@shared/service-proxies/service-proxies';

@Component({
    selector: 'alterationItem',
    templateUrl: './alterationitem.component.html'
})
export class AlterationItemComponent extends AppComponentBase {
    @ViewChild('itemTimelineModal') modal: ModalDirective;
    items: TechFileInfoHistoryDto[] = [];

    constructor(
        injector: Injector,
        private _techService: TechFileInfoServiceProxy,
        public _zone: NgZone
    ) {
        super(injector);
    }

    show(id?: string): void {
        this._techService.getTechFileInfoHistory(id).subscribe(result => {
            this.items = result;
        });
        this.modal.show();
    }

    close(): void {
        this.modal.hide();
    }
}
